home *** CD-ROM | disk | FTP | other *** search
- Path: newshub.cts.com!usenet
- From: khill@cts.com (Kevin E. Hill)
- Newsgroups: comp.lang.c++
- Subject: Pointers to Objects and passing around....
- Date: Mon, 01 Jan 1996 20:00:28 GMT
- Organization: CTS Network Services
- Message-ID: <4c9arr$1oi@news2.cts.com>
- NNTP-Posting-Host: den.cts.com
-
- Well, the color,pen and brush variables are defined as follows in the
- class definition:
-
- TColor *color;
- TPen *pen;
- TBrush *brush;
-
- so why doesn't this work?
-
- void CPlanet::Draw(TDC& dc)
- {
- dc.SelectObject( *pen );
- dc.SelectObject( *brush );
- dc.Ellipse(this->loc.x , this->loc.y , this->loc.x + this->mass ,
- this->loc.y + this->mass);
- dc.RestorePen();
- dc.RestoreBrush();
- }
-
- CPlanet::CPlanet(Clocation loc, Clocation vector, float mass, float
- speed) : CThing(loc,vector,mass,speed)
- {
- color = new TColor(rand() % 256, rand() % 256, rand() % 256);
- pen = new TPen( *color );
- brush = new TBrush( *color );
- }
-
-
-